import './MySeckill.scss'
import React, { Component } from 'react';
import { index_goodlist } from '../../utils/api'
class MySeckill extends Component {
    constructor(props) {
        super(props);
        this.state = {
            list: []
        }

    }
    componentDidMount() {
        index_goodlist().then((res) => {
            // console.log(res.data.list)
            this.setState(
                this.state.list = res.data.list
            )

        })
    }
    render() {
        return (
            <div className='worthbuy'>
                <div className="top">
                    <div className='buy'>今日值得买<span className='time'>00:40:10</span>后结束</div>
                    <span className='more'>MORE</span>
                </div>
                <div className='list1'>
                    {
                        this.state.list.map((item, index) => {
                            return (
                                <div className='listbox' key={index}>
                                    <div className='imgbox'>
                                        <img src={item.pic} />
                                    </div>
                                    <div className='content'>
                                        <h3>{item.name}</h3>
                                        <p>原价￥<span className='price1'>{item.orprice}</span></p>
                                        <p>抢购价￥<span className='price2'>{item.salesPrice.value}</span></p>
                                    </div>
                                </div>
                            )
                        })
                    }
                </div>
            </div>
        );
    }
}

export default MySeckill;